<?php
class App_Model_Widget extends Zend_Db_Table_Abstract{
	
	protected $_name = 'widget';
	protected $_primary = 'id';
	

	public function addWidBaner($text,$koloro,$file){
		$dw = new Zend_Db_Table('definicja_widgetu');
		$dw->getAdapter()->beginTransaction();
		try {
		
			$dwrow = $dw->getAdapter()->fetchRow("SELECT * FROM definicja_widgetu WHERE id=1");
			
			$tmpTable = new Zend_Db_Table($dwrow['tabela_sql']);
			
			$data=null;
			$data['src'] = $file;
			$data['tlo_kolor'] =$koloro;
			$data['text'] = $text;
			$data['text_top'] =0;
			$data['text_left'] =0;
			$tmpTable->insert($data);
			$dw->getAdapter()->commit();
			return 1;
			
		} catch (Zend_Exception $e) {
			$dw->getAdapter()->rollBack();
			return $e->getMessage();
		}
	}
	
	public function getWidBanerHtml() {
		
	}
	
	
}